import { useState } from "react"
import ChatBtnList from './chat-btnlist'
import Chat from './chat-chat'


const contacts = [
  { name: 'Taylor', email: 'taylor@mail.com' },
  { name: 'Alice', email: 'alice@mail.com' },
  { name: 'Bob', email: 'bob@mail.com' }
];


export default function StateChat(){
	const [ to ,setTo] =useState(contacts[0])
	return (
		<div className="flex">
		 <ChatBtnList chatList={contacts} selectedContact={to} onSelect={(contact)=>{setTo(contact);console.log('我在运行中...')}}></ChatBtnList>
		 <Chat contact={to} key={to.email}></Chat>
		</div>
	)
}